import java.util.Arrays;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        int[][] arr = {{1,2,3},{4,5,6}};
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.println(arr[i][j]+" ");
            }
        }
    }
    public static void main8(String[] args) {
        int[][] arry1 = {{1,2,3},{4,5,6}};//初始化定义
        int[][] arry2 = new int[2][3];//不初始化定义
    }
    public static void main7(String[] args) {
        int[] arry={1,2,3,4,5};
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入一个整数:");
        int key = sc.nextInt();
        int left=0;
        int right=arry.length-1;
        int mid = 0;
        int flag=-1;
        while(left<=right) {
            mid=(left+right)/2;
            if (key < arry[mid]) {
                right = mid-1;
            }else if(key > arry[mid]) {
                left = mid+1;
            }else {
                System.out.println("找到了");
                flag=1;
                break;
            }
        }
        if (flag==-1) {
            System.out.println("没有这个数");
        }
    }
    public static void main5(String[] args) {
        int[] arry={1,2,3,4,5};
        Scanner sc = new Scanner(System.in);
        System.out.print("输入一个整数:");
        int num = sc.nextInt();
        for (int i = 0; i < arry.length; i++) {
            if (num == arry[i]) {
                System.out.println("有此数,下标为:"+i);
                break;
            }
            if (i == arry.length-1) {
                System.out.println("没有此数");
            }
        }
    }
        public static void main4(String[] args) {
            int[] arr = {9, 9, 1};
            int sum = 0;
            for (int i = 0; i < arr.length; i++) {
                sum += arr[i];
            }
            int avg = sum / arr.length;
            System.out.println(avg);
        }
    public static void main2(String[] args) {
        int[] arr= {1,2,3,4,5,6};
        int left = 0;
        int right = arr.length-1;
        int tmp = 0;
        while(left<right) {
            tmp = arr[left];
            arr[left] = arr[right];
            arr[right] = tmp;
            left++;
            right--;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
    public static int[] Fun(int[] arr) {
        for (int i = 0; i < arr.length-1; i++) {
            for (int j = 0; j < arr.length-1-i; j++) {
                if (arr[j]>arr[j+1]) {
                    int tmp = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = tmp;
                }
            }
        }
        return arr;
    }
    public static void main1(String[] args) {
        int[] arr = {9,4,2,1,0,7,8,3,6,5};
        Fun(arr);
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");
        }
    }
}
